<?php
defined('BASEPATH') OR exit('No direct script access allowed');


use QCloud_WeApp_SDK\Mysql\Mysql as DB;


class OrderPay extends CI_Controller
{

    public function index()
    {
        $ordernum = $_POST['ordernum'];
        $userid = $_POST['userid'];
        $nonceStr = $_POST['nonceStr'];
        $prepay_id = $_POST['prepay_id'];

        $rows = DB::update('cc_order',['nonceStr' => $nonceStr,'prepay_id' => $prepay_id], ['userid' => $userid, 'ordernum' => $ordernum]);

        if (!empty($rows)) {
            $this->json([
                'code' => 0,
                'data' => $rows
            ]);
        } else {
            $this->json([
                'code' => -1,
                'error' => $rows['error']
            ]);
        }
    }
}
